<?php
class ControllerTestCase extends Zend_Test_PHPUnit_ControllerTestCase
{
    /** @var Zend_Application */
    protected $application;
    
    protected $_validEmail = "inskips@gmail.com";
    protected $_validPassword = "5k1ppy";
    protected $_invalidUser = "no@user.com";
    protected $_invalidPassword = "badpass";
    
    public function setUp()
    {
        $this->bootstrap = array($this, 'appBootstrap');
        parent::setUp();
    }
    
    public function appBootstrap()
    {
        $this->application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
        $this->application->bootstrap();
        
        $bootstrap = $this->application->getBootstrap();
        $front = $bootstrap->getResource('FrontController');
        $front->setParam('bootstrap', $bootstrap);
    }
    
    protected function loginUser($email, $password, $remember = false)
    {
        $this->resetResponse();
        
        $this->getRequest()
             ->setMethod('POST')
             ->setPost(array(
                 "email" => $email,
                 "password" => $password,
                 "public" => $remember,
                 "submit" => "Login"
             ));
        
        $this->dispatch('/account/account/login');

        $this->resetRequest()
             ->resetResponse();
             
        $this->request->setPost(array());
    }
}